<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="./css/register.css">
    <link rel="stylesheet" href="./css/sx.css.css">
    <style>
        header{
            width: 100%;
            background: 0 0 repeat-y url(./img/z.png);
            background-size: cover;
            height: 920px;
            background-repeat: no-repeat;
            position: relative;

        }

    </style>
</head>
<body>
    <header>
      <main>
     <div>
         <span>账号</span>
         <input type="text" placeholder="请输入要申请的账号" id="tex">
     </div>
     <div>
         <span>密码</span>
         <input type="password" placeholder="请输入您的密码" id="tex1">
     </div>
     <div>
        <input type="button" value="注册" id="bnt">
    
     </div>
      </main>   
    </header>
</body>
<script src="./api/axios.js"></script>
<script>
   let ainput=document.querySelectorAll('input')
   ainput[2].onclick=function(){
         axios.get('http://jx.xuzhixiang.top/ap/api/reg.php',{
        params:{
            username:ainput[0].value,
            password:ainput[1].value
        }
    }).then(res=>{
        let data=res.data
        console.log(res)
       if(data.code==0){
           alert('用户名已存在，请重试')
       }else{

          location.href='login.html'
       }
    })
   }
  
</script>
</html>